<?php
$this->headTitle('Tài khoản','append');
?>
<div class="dashboard-menu dashboard-admin">
    <span class="back">&nbsp;</span>
    <h1>Tài khoản người dùng</h1>

        <?php if($this->acl->checkAllowed(array('moduleName'=>'admin','controllerName'=>'user','actionName'=>'add'))){ ?>
            <a class="btn btn-danger" href="<?php echo $this->url(array('module'=>'admin', 'controller'=>'user', 'action'=>'add'));?>">
                Thêm mới
            </a>
        <?php } ?>
</div>
<div class="row placeholders">
    <div class="col-md-12">
        <div class="widget-big">
            <div class="table table-responsive">
                <div class="search-result">
                    <table class="table table-bordetext-danger table-striped table-condensed table-hover" border="0" cellspacing="0" cellpadding="0">
                        <thead>
                            <tr class="warning">
                                <th style="width:5%;">ID</th>
                                <th style="width:10%;">Username</th>
                                <th style="width:15%;">Email</th>
                                <th style="width:10%;">Di động</th>
                                <th style="width:15%;">Tên</th>
                                <th style="width:5%;">Giới</th>
                                <th style="width:10%;">Ngày sinh</th>
                                <th style="width:10%;">Loại T.Khoản</th>
                                <th style="width:5%;">Số dư</th>
                                <th style="width:5%;">Ava</th>
                                <th style="width:5%;">T.Trạng</th>
                                <th style="width:5%;">C.Năng</th>
                            </tr>
                        </thead>
                        <tbody>
                        <?php
                            foreach ($this->userList as $user){
                        ?>
                            <tr>
                                <td style="width:5%;" class="text-left"><?=$user['userId'];?></td>
                                <td style="width:10%;" class="text-left"><?=$user['username'];?></td>
                                <td style="width:15%;" class="text-left"><?=$user['email'];?></td>
                                <td style="width:10%;" class="text-left"><?=$user['mobile'];?></td>
                                <td style="width:15%;" class="text-left"><?=$user['fullname'];?></td>
                                <td style="width:5%;" class="text-left"><?=($user['sex']==0)?"Nam":"Nữ"?></td>
                                <td style="width:10%;" class="text-left"><?=($user['birth']!=0)?date("Y-m-d",$user['birth']):"";?></td>
                                <td style="width:10%;" class="text-left">
                                <?php 
                                    if($user['role'] == 0)
                                        echo "<div style='color: green;'>Cá nhân</div>";
                                    else 
                                        echo "<div style='color: red;'>Doanh nghiệp</div>";
                                ?>
                                </td>
                                <td style="width:5%;" class="text-left"><?=$user['gold'];?></td>
                                <td style="width:5%;" class="text-left">
                                    <img class="avatar" src="<?=$user['avatar']?>" style="width:40px;height:40px;" title="Hình đại diện" onerror="this.onerror=null;this.src='/static/images/noimage.jpg';"/>
                                </td>
                                <td style="width:5%;" class="text-left">
                                    <?=($user['status']==1)?
                                    "<span class='active glyphicon glyphicon-ok' title='Enable'></span>":
                                    "<span class='active glyphicon glyphicon-minus' title='Disable'></span>"?>
                                </td>
                                <td style="width:5%;" class="text-left">
                                <?php if($this->acl->checkAllowed(array('moduleName'=>'admin','controllerName'=>'user','actionName'=>'edit'))) ?>
                                    <a class="glyphicon glyphicon-pencil" href="<?=$this->url(array('module'=>'admin', 'controller'=>'user', 'action'=>'edit', 'userId'=>$user['userId']))?>" title="Sửa thông tin tài khoản"></a>
                                    &nbsp;&nbsp;
                                <?php if($this->acl->checkAllowed(array('moduleName'=>'admin','controllerName'=>'user','actionName'=>'delete'))) ?>
                                    <a class="glyphicon glyphicon-remove" href="<?=$this->url(array('module'=>'admin', 'controller'=>'user', 'action'=>'delete', 'userId'=>$user['userId']))?>" title="Xoá tài khoản"></a>
                                </td>
                            </tr>
                        <?php
                            } 
                        ?>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="clearfix"></div>
        </div>
    </div>
</div>